import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/**
 * 懒加载
 * @see https://router.vuejs.org/zh-cn/advanced/lazy-loading.html
 */
const Index = () => import('../views/Index')

const Demo = () => import('../views/demo/Demo')

const Account = () => import('../views/account/Account')

const Products = () => import('../views/product/Products')

const Category = () => import('../views/category/Category')

const Brand = () => import('../views/brand/Brand')

const Template = () => import('../views/template/Template')

const ProductAddOrModify = () => import('../views/product/ProductAddOrModify')

const Shops = () => import('../views/shop/Shops')

const ShopAddOrModify = () => import('../views/shop/ShopAddOrModify')

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index,
      children: [
        {
          path: '/demo',
          name: 'Demo',
          component: Demo
        },
        {
          path: '/account',
          name: 'Account',
          meta: {
            breadcrumb: ['用户', '账号管理']
          },
          component: Account
        },
        {
          path: '/category',
          name: 'Category',
          meta: {
            breadcrumb: ['产品', '类目管理']
          },
          component: Category
        },
        {
          path: '/brand',
          name: 'Brand',
          meta: {
            breadcrumb: ['产品', '品牌管理']
          },
          component: Brand
        },
        {
          path: '/template',
          name: 'Template',
          component: Template
        },
        {
          path: '/products',
          name: 'Products',
          meta: {
            breadcrumb: ['产品', '产品管理']
          },
          component: Products
        },
        {
          path: '/product',
          name: 'ProductAddOrModify',
          meta: {
            breadcrumb: ['产品', '新增产品']
          },
          component: ProductAddOrModify
        },
        {
          path: '/shops',
          name: 'Shops',
          meta: {
            breadcrumb: ['店铺', '店铺管理']
          },
          component: Shops
        },
        {
          path: '/shop',
          name: 'ShopAddOrModify',
          meta: {
            breadcrumb: ['店铺', '新增店铺']
          },
          component: ShopAddOrModify
        }
      ]
    }
  ]
})
